//
//  ViewController.m
//  NSNumber回顾
//
//  Created by apple on 15/9/9.
//  Copyright (c) 2015年 戴维营. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

#if 0
    NSNumber *num = [NSNumber numberWithInt:123];
    
    NSNumber *num1 = @23;
    
    NSLog(@"@--->%@",num.stringValue);
    NSLog(@"int--->%d",num.intValue);
    
    
    //NSNumber对象可以比较大小，并且实现了NSCoding和NSCopying协议；
    
    if ([num compare:num1] == NSOrderedAscending)
    {
        NSLog(@"num <num1");
    }
#endif
    
#if 1
    
    //在不同的场合下，我们需要输出不同的数字格式，NSNumberFormatter能够让我们讲数值按一定的规则转换成不同格式的字符床，用于输出
    
    //1⃣️、创建一个NSNumberFormatter对象，
    NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
    
    //2⃣️、规定输出格式；
    [numberFormatter setNumberStyle:NSNumberFormatterSpellOutStyle];
    
    NSString *formattedNumberString = [numberFormatter stringFromNumber:@12234];
    
    NSLog(@"%@",formattedNumberString);
    
    NSString *str = [NSNumberFormatter localizedStringFromNumber:@12345.54 numberStyle:NSNumberFormatterCurrencyStyle];
    
    NSLog(@"%@",str);
    
    
#endif
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
